<? 
include ("inc_security.php"); 
//check quyền them sua xoa
checkAddEdit("edit");

$record_id		=	getValue("record_id");
$field			=	getValue("field", "str", "GET", "use_active");
$value			=	0;
$iCat				=	0;
$url				=	base64_decode(getValue("url", "str", "GET", base64_encode("publisher.php")));

//Lay ra trang thai hien tai
$db_select		=	new db_query("SELECT pro_date, pro_funding_duration, pro_funding_deadline, " . $field . "
											FROM	" . $fs_table . "
											WHERE	" . $id_field . " = " . $record_id);
if($row				=	mysql_fetch_assoc($db_select->result)){
    
	$value			=	abs($row[$field] - 1);
	$db_exe	=	new db_execute("UPDATE " . $fs_table . " SET " . $field . " = ".$value." WHERE ".$id_field." = " . $record_id);
    //Cập nhật thời gian dự án bắt đầu launch
    $pro_date = $row['pro_date'];
    if($row['pro_funding_duration']){
        $duration = $row['pro_funding_duration'] - $pro_date;
        //update thời gian
        $db_update = new db_execute('UPDATE projects SET pro_date = '.($pro_date+$duration).' WHERE pro_id = '.$record_id);
        unset($db_update);
    }
    if($row['pro_funding_deadline']){
        $db_update = new db_execute('UPDATE projects SET pro_date = '.time().' WHERE pro_id = '.$record_id);
        unset($db_update);
    }
	unset($db_exe);
	echo	'<img border="0" src="' . $fs_imagepath . 'check_' . $value . '.gif" />';
}

unset($db_select);

?>